{include file="public_iframe:head"}
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>文章列表</h5>
            <div class="ibox-tools" style="margin-top: -9px;">
                <a href="javascript:location.reload();" class="btn btn-primary"><i class="fa fa-refresh"></i> 刷新</a>
            </div>
        </div>
        <div class="ibox-content">
            <div class="row row-lg">
                <div class="col-sm-12">
                    <!--<h4 class="example-title"></h4>-->
                    <a class="btn btn-primary" href="{:url('Article/add',array('cid'=>$cid))}">添加文章</a>
                    <br/>
                    <div class="table-responsive">
                        <!--class="table table-bordered table-hover"-->
                        <table data-toggle="table" class="table table-bordered table-hover"
                        >
                            <thead>
                            <tr  style="background: #f9f9f9;">
                                <th>编号</th>
                                <th>文章标题</th>
                                <th>是否发布</th>
                                <th>创建时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name="list" id="vo"}
                            <tr>
                                <td>{$vo['id']}</td>
                                <td>{$vo.title}</td>
                                <td>
                                    {if condition="$vo['status']=='1'"}发布{else/}不发布{/if}
                                </td>
                                <td>{$vo.create_time|date="Y-m-d H:i:s",###}</td>
                                <td>
                                    <a href="{:url('Article/edit',array('id'=>$vo['id']))}" class="btn btn-primary">编辑</a>
                                    <a  href="javascript:;" data-id="{$vo.id}"  class="btn btn-danger" >删除</a>
                                </td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="col-sm-12">
                    <!-- Example Pagination -->
                    <ul class="pagination  pull-right">
                        {$page}
                    </ul>
                    <!-- End Example Pagination -->
                </div>
            </div>
        </div>
    </div>
    <!-- End Panel Basic -->
</div>

<!-- 全局js -->
<script src="__STATIC__/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="__STATIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>
<script>
    //删除
    $(".btn-danger").click(function(){
        var id = $(this).attr('data-id');
        parent.layer.confirm('删除数据无法恢复，并且会影响用户数据，确定删除？', {
            shade:false,
            btn: ['确定', '取消']
        }, function() {
            $.post("{:url('Article/del')}", {id: id}, function (result) {
                if (result.code == '0') {
                    parent.layer.alert(result.msg);
                } else {
                    parent.layer.msg(result.msg, {
                                icon:1
                            },
                            function (index, item) {
//								parent.layer.close(index);
                                location.reload();
                            });
                }
            });
        });
    })
</script>
</body>

</html>
